Release 10.1A: OpenEdge Development:
Java Open Clients


Managing ProDataObject mappings to temp-tables

OpenEdge releases prior to 10.1A provide only a streaming data model for accessing temp-tables (TABLE and TABLE-HANDLE only) as parameters using the java.sql.ResultSet object. This model requires the client application (for output parameters) or the Open Client proxy (for input parameters) to request data from the sender (through the SQL ResultSet) instead of allowing the sender to set the data in the receiver. It relies on a call back mechanism to access the data one row at a time. Thus, a temp-table is accessible in only one direction, like a one-directional tape. For more information on the SQL ResultSet mechanism, see Appendix C "Passing Temp-tables as SQL ResultSet Parameters."

The Java SDO architecture available in the current release is based on a disconnected data model that caches rows of temp-table data in memory using the DataObject interface. This model provides a scrollable access mechanism that allows you to directly access any row of a temp-table that is part of a 4GL DATASET or DATASET-HANDLE parameter and also any row of single temp-table passed as a TABLE or TABLE-HANDLE parameter. (For more information on accessing TABLE and TABLE-HANDLE parameters, see the "Passing temp-tables as ProDataGraph parameters" section.)

The SQL ResultSet and Java SDO DataObject mechanisms support a different set of mappings for fields in a temp-table. The OpenEdge ProDataObject further extends this DataObject mechanism to map 4GL data types not supported in the base mechanism. The following sections describe the mappings for temp-table fields supported by this extended ProDataObject mechanism.

Mapping single-valued fields

As described in a previous section (see the "Java SDO Foundations" section), a DataObject (and its ProDataObject extension) represents a temp-table field as a column Property object containing its value, with an associated Type object, specifying its data type. Table 5–3 shows the ProDataObject mappings to temp-table fields supported by OpenEdge.

Table 5–3: Java ProDataObject mappings to temp-table fields 
4GL temp-table field data type
Java ProDataObject Property data type
BLOB 
byte[] 
CHARACTER 
java.lang.String 
CLOB 
java.loan.String 
COM-HANDLE 
long 
DATE 
java.util.GregorianCalendar 
DATETIME 
java.util.GregorianCalendar 
DATETIME-TZ 
java.util.GregorianCalendar 
DECIMAL 
java.math.BigDecimal 
INTEGER 
int 
LOGICAL 
boolean 
RAW 
byte[] 
RECID 
long 
ROWID 
byte[] 
WIDGET-HANDLE 
long 

In addition to the value, the Property object contains other information about the ProDataObject column that corresponds to the temp-table field, including its position in the row of columns (indicated by a property index) and the property name, which is identical to the 4GL name of the temp-table field.

The ProDataObject class has methods for setting and getting the values of its column Property objects, accessed by property name or index according to data type. For more information, see the "ProDataObject class" section.

Mapping array fields

In the Progress 4GL, a temp-table field can be defined with an extent (an integer value). This extent specifies the size of an array field, which is a one-dimensional array of the specified data type. Similarly in a Java SDO DataObject, the Type associated with a Property object can be defined as many-valued. Thus, a many-valued property of any Java data type listed in Table 5–3 can be mapped to a temp-table array field of the corresponding 4GL data type.

The ProDataObject class has methods for setting and getting the values of its many-valued column Property objects, accessed as List objects by property name or index. To determine if a Property object is many-valued, you can use the isMany() method on the Property. For more information on working with the values of many-valued properties, see the descriptions of the getList() and setList() methods in the "ProDataObject class" section.

Mapping the Unknown value (?)

In the Progress 4GL, a temp-table field can be specified with an Unknown value (?), similar to null in Java. If you need to determine if a field has been set to the Unknown value (?), you can use one of the ProDataObject isSet() methods to test property by name or index. These methods return true if the corresponding temp-table field is set to a value other than the Unknown value (?) and return false if the field is set to the Unknown value (?). For more information on the isSet() methods, see the "ProDataObject class" section. If you want to set a column property so the corresponding temp-table field is set to the Unknown value (?), do not set the property to any value.

Specifying initial values

Java SDO does not support setting an initial (or default) value for a property within a DataObject. So, you must explicitly set all initial values for column properties.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095